package com.xbongbong.saas.enums.business;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.pro.constant.CommonConstant;
import com.xbongbong.pro.constant.I18nStringConstant;
import com.xbongbong.pro.enums.PaasStageEnum;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * 销售机会枚举类
 * 注意：
 * 1.强制：attr的值一经刷入数据库，就不允许改变（比如text_1不允许改为text_12，即使不冲突，因为后续会根据枚举中saasAttr和attr的对应关系来获取解释）
 * 2.强制：属性修饰必须为private，比如private String attr（后续反射获取属性时会依赖到）
 * 3.强制：属性的名称必须和FieldAttrEntity实体中的属性一致，不然无法赋值过去
 *
 * @author long.rao
 * @date 2019/1/17 19:35
 */
@Getter
public enum SalesOpportunityEnum {
    // 销售机会模板设置界面展示字段
    // 基本信息
    BASE_INFO("other_1", "enum.salesOpportunity.attrName.base_info", "baseInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 10000, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    NAME("text_1", "enum.salesOpportunity.attrName.name", "name", FieldTypeEnum.TEXT.getType(), SetTypeEnum.DISABLE_NONE.getCode(), 1, 0, ShowTypeEnum.ALL.getCode(), 9990, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    SERIAL_NO("serialNo", "enum.salesOpportunity.attrName.serial_no", "opportunityNo", FieldTypeEnum.SERIALNO.getType(), SetTypeEnum.DISABLE_ALL.getCode(), 1, 0, ShowTypeEnum.ALL.getCode(), 9980, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    CUSTOMER_NAME("text_3", "enum.salesOpportunity.attrName.customer_name", "customerName", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9970, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    CONTACT_NAME("text_4", "enum.salesOpportunity.attrName.contact_name", "contactName", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9960, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    SALE_STAGE("text_17", "enum.salesOpportunity.attrName.sale_stage", "saleStage", FieldTypeEnum.STAGE_THRUSTER.getType(), 2, 0, 0, ShowTypeEnum.ALL.getCode(), 9950, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    WASTAGE("text_18", "enum.salesOpportunity.attrName.wastage", "wastage", FieldTypeEnum.COMBO.getType(), SetTypeEnum.DISABLE_OPEN.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9940, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    WASTAGE_MEMO("text_19", "enum.salesOpportunity.attrName.wastage_memo", "wastageMemo", FieldTypeEnum.TEXTAREA.getType(), SetTypeEnum.DISABLE_OPEN.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9930, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    OWNER_ID("ownerId", "enum.salesOpportunity.attrName.owner_id", "ownerId", FieldTypeEnum.OWNERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9920, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    COUSER_ID("coUserId", "enum.salesOpportunity.attrName.couser_id", "coUserId", FieldTypeEnum.COUSERID.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9910, 1, 0, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    // 销售信息
    SALE_INFO("other_2", "enum.salesOpportunity.attrName.sale_info", "saleInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9900, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    PRODUCTS("array_1", "enum.salesOpportunity.attrName.products", "products", FieldTypeEnum.SELECT_PRODUCT.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9890, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    ESTIMATE_AMOUNT("num_1", "enum.salesOpportunity.attrName.estimate_amount", "estimateAmount", FieldTypeEnum.NUM.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9880, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    ESTIMATE_END_TIME("date_1", "enum.salesOpportunity.attrName.estimate_end_time", "estimateEndTime", FieldTypeEnum.DATETIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9870, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    COST("num_2", "enum.salesOpportunity.attrName.cost", "cost", FieldTypeEnum.NUM.getType(),SetTypeEnum.DISABLE_OPEN.getCode(), 0, 0, ShowTypeEnum.ALL.getCode(), 9860, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    GROSS_PROFIT("num_3", "enum.salesOpportunity.attrName.gross_profit", "grossProfit", FieldTypeEnum.NUM.getType(), SetTypeEnum.DISABLE_OPEN.getCode(), 0, 0, ShowTypeEnum.ALL.getCode(), 9850, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    GROSS_PROFIT_RATE("num_4", "enum.salesOpportunity.attrName.gross_profit_rate", "grossProfitRate", FieldTypeEnum.NUM.getType(), SetTypeEnum.DISABLE_OPEN.getCode(), 0, 0, ShowTypeEnum.ALL.getCode(), 9840, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    //与ESTIMATE_END_TIME的区别是attrName不同
    ANOTHER_ESTIMATE_END_TIME("date_1", "enum.salesOpportunity.attrName.another_estimate_end_time", "estimateEndTime", FieldTypeEnum.DATETIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9870, 1, 1, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // 扩展信息
    EXTEND_INFO("other_3", "enum.salesOpportunity.attrName.extend_info", "extendInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9830, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    IMPORTANT_DEGREE("num_7", "enum.salesOpportunity.attrName.important_degree", "importantDegree", FieldTypeEnum.STAR.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9820, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    DECISION_MAKER("text_8", "enum.salesOpportunity.attrName.decision_maker", "decisionMaker", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9810, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    COMPETITOR("text_9", "enum.salesOpportunity.attrName.competitor", "competitor", FieldTypeEnum.TEXT.getType(), SetTypeEnum.DISABLE_NONE.getCode(), 1, 0, ShowTypeEnum.ALL.getCode(), 9800, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // 系统信息
    SYSTEM_INFO("other_4", "enum.salesOpportunity.attrName.system_info", "systemInfo", FieldTypeEnum.SEPARATOR.getType(), SetTypeEnum.DISABLE_REPEAT.getCode(), 1, 0, ShowTypeEnum.EDIT_DETAIL.getCode(), 9790, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    CREATOR_ID("creatorId", "enum.salesOpportunity.attrName.creator_id", "creatorId", FieldTypeEnum.CREATORID.getType(), 1, 0, 0, ShowTypeEnum.ALL.getCode(), 9780, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    ADD_TIME("addTime", "enum.salesOpportunity.attrName.add_time", "addTime", FieldTypeEnum.ADDTIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9770, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    UPDATE_TIME("updateTime", "enum.salesOpportunity.attrName.update_time", "updateTime", FieldTypeEnum.UPDATETIME.getType(), 1, 1, 0, ShowTypeEnum.ALL.getCode(), 9760, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // 模板设计界面不需要展示的字段
    LAST_CONNECT_TIME("date_2", "enum.salesOpportunity.attrName.last_connect_time", "lastConnectTime", FieldTypeEnum.DATETIME.getType(), 1, 0, 1, ShowTypeEnum.LIST.getCode(), 9740, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    // 逻辑字段
    IS_ARCHIVED("num_8", "enum.salesOpportunity.attrName.is_archived", "isArchived", FieldTypeEnum.COMBO_NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9750, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //  CURRENCY("text_12", "币种Id", "currency", FieldTypeEnum.TEXT.getType(), 1, 0, 0, ShowTypeEnum.NONE.getCode(), 9820, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    UNIT("text_13", "enum.salesOpportunity.attrName.unit", "unit", FieldTypeEnum.COMBO.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9730, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    EXCHANGE_RATE("num_5", "enum.salesOpportunity.attrName.exchange_rate", "exchangeRate", FieldTypeEnum.NUM.getType(), 1, 0, 1, ShowTypeEnum.LIST.getCode(), 9720, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    CUSTOMER_NAME_LINK_TEXT("text_14", "enum.salesOpportunity.attrName.customer_name_link_text", "customerNameLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9710, 1, 1, ScreenTypeEnum.SCREEN_OFF.getType()),
    CONTACT_NAME_LINK_TEXT("text_15", "enum.salesOpportunity.attrName.contact_name_link_text", "contactNameLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9700, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    DECISION_MAKER_ID_LINK_TEXT("text_16", "enum.salesOpportunity.attrName.decision_maker_id_link_text", "contactNameLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9690, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //TODO haibin.zhang 其他金额
    OTHER_CHARGE("num_6", "enum.salesOpportunity.attrName.other_charge", "otherCharge", FieldTypeEnum.NUM.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9680, 0, 0, ScreenTypeEnum.SCREEN_OFF.getType()),

    //阶段流程id
    STAGE_PROCESS_ID(PaasStageEnum.STAGE_PROCESS_ID.getAttr(), "enum.salesOpportunity.attrName.stage_process_id", PaasStageEnum.STAGE_PROCESS_ID.getSaasAttr(), FieldTypeEnum.LONG.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9980, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //阶段id
    STAGE_ID(PaasStageEnum.STAGE_ID.getAttr(), "enum.salesOpportunity.attrName.attrName.stage_id", PaasStageEnum.STAGE_ID.getSaasAttr(), FieldTypeEnum.LONG.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9981, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    //阶段比率
    STAGE_RATIO(PaasStageEnum.STAGE_RATIO.getAttr(),"enum.salesOpportunity.attrName.attrName.stage_ratio", PaasStageEnum.STAGE_RATIO.getSaasAttr(), FieldTypeEnum.STAGE_RATIO.getType(), ScreenTypeEnum.SCREEN_GROUP.getType(), 0, 0, ShowTypeEnum.ALL.getCode(), 9911, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),

    // 竞争对手新加字段
    // 关联竞争对手
    LINK_COMPETITOR("text_81", "enum.salesOpportunity.attrName.link_competitor", "linkCompetitor", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9921, 1, 0, ScreenTypeEnum.SCREEN_SEARCH.getType()),
    // 赢单竞品
    WIN_COMPETITOR("text_82", "enum.salesOpportunity.attrName.win_competitor", "winCompetitor", FieldTypeEnum.LINK_BUSINESS_SINGLE.getType(), 3, 1, 0, ShowTypeEnum.ALL.getCode(), 9931, 1, 0, ScreenTypeEnum.SCREEN_GROUP.getType()),
    LINK_COMPETITOR_LINK_TEXT("text_83", "enum.salesOpportunity.attrName.link_competitor_link_text", "linkCompetitorLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9941, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    WIN_COMPETITOR_LINK_TEXT("text_84", "enum.salesOpportunity.attrName.win_competitor_link_text", "winCompetitorLinkText", FieldTypeEnum.TEXT.getType(), 1, 0, 1, ShowTypeEnum.NONE.getCode(), 9951, 1, 0, ScreenTypeEnum.SCREEN_OFF.getType()),
    ;
    /**
     * 英文名称
     */
    private String attr;
    /**
     * 中文名称
     */
    private String attrName;
    /**
     * 对应saas中的attr
     */
    private String saasAttr;
    /**
     * 字段类型，详见
     *
     * @see com.xbongbong.paas.enums.FieldTypeEnum
     */
    private Integer fieldType;
    /**
     * 重命名、判重、启用必填等权限
     * 1.重命名+字段权限
     * 2.重命名+字段权限+查重
     * 3.重命名+字段权限+启用、必填
     * 4.重命名+字段权限+查重+启用、必填
     * 注：pro中启用和必填是同一个权限，同时启用或同时关闭
     */
    private Integer setType;
    /**
     * 模板设计阶段字段是否允许编辑
     * 1：允许编辑
     * 0：不允许编辑
     */
    private Integer designEditable;
    /**
     * 字段是否显示在模板设计界面
     * 1：不显示
     * 0：显示
     */
    private Integer editHide;
    /**
     * 字段在各个界面（新建、编辑、列表、详情）的展现形式
     * 详见
     *
     * @see com.xbongbong.saas.enums.ShowTypeEnum
     */
    private Integer showType;
    /**
     * 字段在模板设计界面的排序
     * 建议不要用连续的数字，可以用等差数列，以防以后在两个字段之间加入新字段
     */
    private Integer sort;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private Integer required;
    /**
     * 筛选类型
     * 1：可筛选
     * 2：不可筛选
     */
    private Integer screenType;


    SalesOpportunityEnum(String attr, String attrName, String saasAttr, Integer fieldType, Integer setType, Integer designEditable,
                         Integer editHide, Integer showType, Integer sort, Integer visible, Integer required, Integer screenType) {
        this.attr = attr;
        this.attrName = attrName;
        this.saasAttr = saasAttr;
        this.fieldType = fieldType;
        this.setType = setType;
        this.designEditable = designEditable;
        this.editHide = editHide;
        this.showType = showType;
        this.sort = sort;
        this.visible = visible;
        this.required = required;
        this.screenType = screenType;
    }

    /**
     * 对data内的字段拼上“data.”
     *
     * @param cache
     * @return java.lang.String
     * @author zcp
     * @date 2019/3/1 18:12
     * @version v1.0
     * @since v1.0
     */
    public static String getAttrConnectData(SalesOpportunityEnum cache) {
        return "data." + cache.getAttr();
    }

    /**
     * 获取es查询、聚合字段
     * data在库内是json对象，对data字段内某个key做es【精确查询】时，需要在其前拼上“data.”，且【text等类型的】要在后面拼“.keyword”
     *
     * @param cache 当前枚举对象
     * @return java.lang.String 处理后的聚合字段
     * @author zcp
     * @date 2019/2/21 14:59
     * @version v1.0
     * @since v1.0
     */
    public static String getEsAttr4Keyword(SalesOpportunityEnum cache) {
        FieldTypeEnum fieldTypeEnum = FieldTypeEnum.getFieldTypeEnum(cache.fieldType);
        //字段类型为text，或者字段在es内的类型时text，则需要在后面拼上“.keyword”
        boolean flag = fieldTypeEnum == FieldTypeEnum.TEXT || "text".equals(fieldTypeEnum.getEsalias());
        if (flag) {
            return "data." + cache.getAttr() + ".keyword";
        }
        return "data." + cache.getAttr();
    }

    /**
     * app端详情默认标题显示字段
     *
     * @return List
     * @author GuoJun.HU
     * @date 2019/4/8 19:21
     * @since V1.0
     */
    public static List<Object> getTitleAttrList() {
        return Collections.singletonList(SERIAL_NO);
    }

    /**
     * 详情默认摘要
     *
     * @author long.rao
     * @date 2019-06-27 15:47
     */
    public static List<Object> getSummaryAttrList() {
        return Arrays.asList(NAME, OWNER_ID, CUSTOMER_NAME, ESTIMATE_END_TIME);
    }

    /**
     * 流程中获取隐藏字段
     *
     * @return
     */
    public static List<SalesOpportunityEnum> getDisableField() {
        List<SalesOpportunityEnum> salesOpportunityEnums = new ArrayList<>();
        for (SalesOpportunityEnum salesOpportunityEnum : values()) {
            if (Objects.equals(salesOpportunityEnum.getShowType(), ShowTypeEnum.NONE.getCode()) || Objects.equals(salesOpportunityEnum.getEditHide(), 1)
                    || Objects.equals(salesOpportunityEnum.getFieldType(), FieldTypeEnum.CREATORID.getType()) || Objects.equals(salesOpportunityEnum.getFieldType(), FieldTypeEnum.ADDTIME.getType())) {
                salesOpportunityEnums.add(salesOpportunityEnum);
            }
        }
        return salesOpportunityEnums;
    }

    /**
     * 获取销售漏斗的统计规则的归属人设置相关字段
     * @return
     */
    public static List<String> getSaleFunnelBelongAttrs() {
        return Arrays.asList(SalesOpportunityEnum.CREATOR_ID.getAttr(), SalesOpportunityEnum.OWNER_ID.getAttr(), SalesOpportunityEnum.COUSER_ID.getAttr());
    }

    /**
     * 获取销售漏斗的统计规则的统计时间设置相关字段
     * @return
     */
    public static List<String> getSaleFunnelTimeAttrs() {
        return Arrays.asList(SalesOpportunityEnum.ADD_TIME.getAttr(), SalesOpportunityEnum.UPDATE_TIME.getAttr(), SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr(), SalesOpportunityEnum.LAST_CONNECT_TIME.getAttr());
    }


    /**
     * 把传入的字段（类型为LINK_BUSINESS_SINGLE）的转为其隐藏字段
     * @param attr 字段名
     * @return java.lang.String
     * @author zcp
     * @date 2019/7/4 15:31
     * @since v1.0
     * @version v1.0
     */
    public static String changeToHide4Link(String attr) {
        if (Objects.equals(attr, CUSTOMER_NAME.attr)) {
            return CUSTOMER_NAME_LINK_TEXT.attr;
        } else if (Objects.equals(attr, CONTACT_NAME.attr)) {
            return CONTACT_NAME_LINK_TEXT.attr;
        } else if (Objects.equals(attr, DECISION_MAKER.attr)) {
            return DECISION_MAKER_ID_LINK_TEXT.attr;
        } else if (Objects.equals(attr, LINK_COMPETITOR.attr)) {
            return LINK_COMPETITOR_LINK_TEXT.attr;
        } else if (Objects.equals(attr, WIN_COMPETITOR.attr)) {
            return WIN_COMPETITOR_LINK_TEXT.attr;
        }
        return attr;
    }

    /**
     * @description 销售机会默认查重结果展示字段
     * @author yanglei
     * @date 2022/11/8 13:41
     * @return List<JSONObject>
     */
    public static List<JSONObject> getCheckRepeatHead() {
        JSONObject opportunityName = new JSONObject();
        opportunityName.put("prop", "opportunityName");
        opportunityName.put("fieldType", NAME.fieldType);
        opportunityName.put("label", NAME.getAttrName());
        opportunityName.put("attr", NAME.attr);
        JSONObject customerName = new JSONObject();
        customerName.put("prop", "customerName");
        customerName.put("fieldType", CUSTOMER_NAME.fieldType);
        customerName.put("label", CUSTOMER_NAME.getAttrName());
        customerName.put("attr", CUSTOMER_NAME.attr);
        JSONObject mainUser = new JSONObject();
        mainUser.put("prop", "mainUser");
        mainUser.put("fieldType", OWNER_ID.fieldType);
        mainUser.put("label", OWNER_ID.getAttrName());
        mainUser.put("attr", OWNER_ID.attr);
        JSONObject addTime = new JSONObject();
        addTime.put("prop", "addTime");
        addTime.put("fieldType", ADD_TIME.fieldType);
        addTime.put("label", ADD_TIME.getAttrName());
        addTime.put("attr", ADD_TIME.attr);
        JSONObject saleStage = new JSONObject();
        saleStage.put("prop", "saleStage");
        saleStage.put("fieldType", SALE_STAGE.fieldType);
        saleStage.put("label", SALE_STAGE.getAttrName());
        saleStage.put("attr", SALE_STAGE.attr);
        JSONObject isArchived = new JSONObject();
        isArchived.put("prop", "isArchived");
        isArchived.put("fieldType", IS_ARCHIVED.getFieldType());
        isArchived.put("label", IS_ARCHIVED.getAttrName());
        isArchived.put("attr", IS_ARCHIVED.getAttr());
        JSONObject option = new JSONObject();
        option.put("prop", "option");
        option.put("fieldType", FieldTypeEnum.OPTION.getType());
        option.put("label", I18nMessageUtil.getMessage(CommonConstant.OPERATE));
        return Arrays.asList(opportunityName,customerName, mainUser, addTime,saleStage, isArchived, option);
    }


    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }

    public static String getI18nValue(String value) {
        return I18nMessageUtil.getMessage(value);
    }
}
